package com.model;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;





import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.GenericGenerator;





@Entity
@Table(name="tb_dept")
public class DeptBean implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -6506121552468518819L;
	@Id
	@GenericGenerator(name = "idGenerator", strategy = "assigned")
	@GeneratedValue(generator = "idGenerator")
	private int id;
	@Column(unique=true)
	private String dept_name;
	private int dept_pid;
	private int levelnum; //层级 0开始
	private Boolean isParent;  //1 父 0子
	
	@OneToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL,mappedBy="dept_id")
	@Fetch(FetchMode.SELECT)
	private Set<StaffBean> stff_list;
	
	@OneToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL,mappedBy="a_use_dept")
	@Fetch(FetchMode.SELECT)
	private Set<AssetsBean> assets_list;
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDept_name() {
		return dept_name;
	}

	public void setDept_name(String dept_name) {
		this.dept_name = dept_name;
	}

	public int getDept_pid() {
		return dept_pid;
	}

	public void setDept_pid(int dept_pid) {
		this.dept_pid = dept_pid;
	}

	public int getLevelnum() {
		return levelnum;
	}

	public void setLevelnum(int levelnum) {
		this.levelnum = levelnum;
	}

	public Boolean getIsParent() {
		return isParent;
	}

	public void setIsParent(Boolean isParent) {
		this.isParent = isParent;
	}

	public Set<StaffBean> getStff_list() {
		return stff_list;
	}

	public void setStff_list(Set<StaffBean> stff_list) {
		this.stff_list = stff_list;
	}

	public Set<AssetsBean> getAssets_list() {
		return assets_list;
	}

	public void setAssets_list(Set<AssetsBean> assets_list) {
		this.assets_list = assets_list;
	}

	public static void main(String[] args) {
		 int str1=1;
		 DecimalFormat df=new DecimalFormat("000");
		     String str2=df.format(str1);
		     System.out.println(str2);
	}
}
